home *** CD-ROM | disk | FTP | other *** search
- ;
- ; *********************************
- ;
- ; Menus example file for Pure Basic
- ;
- ; © 1999 - Fantaisie Software -
- ;
- ; *********************************
- ;
- ;
-
- InitScreen (0) ; We need 1 screen
- InitWindow (0) ; 1 window
- InitTagList (10) ; a taglist upto 11 tags
- InitMenu (0,30) ; 1 menu with maximum 30 items
-
- FindScreen (0,"") ; Find the default screen
-
- ShowScreen() ; Bring it to front of the display
-
- ;
- ; Here are all our menus strings...
- ;
-
- Title1.s = "Project"
- Item1.s = "Open..." : Short1.s = ""
- Item2.s = "Brush" : Short2.s = "B"
- Item3.s = "Picture" : Short3.s = "P"
- Item4.s = "Save as..." : Short4.s = "S"
- Item5.s = "Compression" : Short5.s = ""
- Item6.s = "Quit" : Short6.s = "Q"
-
- ;
- ; Build the menus (note the indentation which is important)
- ;
-
- MenuTitle(Title1)
-
- MenuItem (1, Item1, 0)
- MenuSubItem (2, Item2, Short2)
- MenuSubBar ()
- MenuSubItem (3, Item3, Short3)
-
- MenuItem (4, Item4, Short4)
- MenuCheckItem (5, Item5, Short5, 1)
- MenuBar ()
- MenuItem (6, Item6, Short6) ; Quit
-
- CreateMenu(0, ScreenID()) ; Create our menu
-
- WinTitle.s = "Menu example"
-
- ResetTagList (#WA_Title, WinTitle)
- AddTag (#WA_SmartRefresh,1)
- AddTag (#WA_CustomScreen, ScreenID())
- AddTag (#WA_NewLookMenus, 1)
-
- If OpenWindow(0, 100, 40, 300, 100, #WFLG_CLOSEGADGET | #WFLG_DRAGBAR | #WFLG_DEPTHGADGET | #WFLG_ACTIVATE, TagListID())
-
- AttachMenu(0,WindowID()) ; Attach our menu to the opened window
-
- Compression = 1
-
- Repeat
- VWait()
- IDCMP.l = WindowEvent()
-
- If IDCMP = #IDCMP_MENUPICK
- Select EventGadget()
-
- Case 2
- PrintN("Sub-Menu 'Brush'")
-
- Case 3
- PrintN("Sub-Menu 'Picture'")
-
- Case 4
- PrintN("Menu 'Save As...'")
-
- Case 5
- Print("Menu 'Compression=")
-
- Compression = 1-Compression
-
- If Compression
- PrintN("On")
- Else
- PrintN("Off")
- EndIf
-
- Case 6
- IDCMP = #IDCMP_CLOSEWINDOW
-
- EndSelect
-
- EndIf
-
- Until IDCMP = #IDCMP_CLOSEWINDOW
-
- EndIf
-
- End
-